package org.netty.framework.core.concurrent;

import org.netty.framework.core.NettyServer;

/**
 * 创建业务线程池的工厂
 * 
 * @author chenfanglin
 * @date 2018年9月26日下午6:03:14
 */
public class ThreadPoolExecutorFactory {

	/**
	 * 获取创建的线程池
	 * 
	 * @param nettyServer
	 * @return
	 */
	public static void createThreadPoolExecutor(NettyServer nettyServer) {
		switch (nettyServer.getProtocol()) {
		case HTTP:
			NettyThreadPool httpThreadPool = HttpServerThreadPoolExecutor.getInstance();
			httpThreadPool.createThreadPoolExecutor();
			break;
		case TCP:
			NettyThreadPool tcpThreadPool = TcpServerThreadPoolExecutor.getInstance();
			tcpThreadPool.createThreadPoolExecutor();
			break;
		case WEBSOCKET:
			NettyThreadPool webSocketThreadPool = WebSocketServerThreadPoolExecutor.getInstance();
			webSocketThreadPool.createThreadPoolExecutor();
			break;
		default:
			break;
		}
	}
}
